import send_msg from './_service';

/*
 * 编码服务
 * @param _action_id 系统参数action_id
 * @param _session_id 系统参数session_id
 * @param spaceid 系统参数spaceid
 * @param systemid 当前项目systemid
 * @param pname 编码规则
 * @param setinfo 编码前缀
 * @param n 获取编码个数
 */
export default async function doc_code(_action_id: string, _session_id: string, spaceid: string, systemid: string, pname: string, setinfo: string, n: number) {
	const msg = {
		n,
		pname,
		setinfo,
		spaceid,
		systemid
	};
	const data = await send_msg<{
		code: '1';
		msg: string;
		result: string;
		results: string[];
	}>('dataservice.finddoccode', msg, false, false);
	if (data.code === '1') {
		return data;
	} else {
		throw Error(data.msg);
	}
}
